package yf.mall.enums;

import lombok.Getter;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * 订单状态。PAY_SUCC：支付完成； REFUND：退款； SETTLE：结算；CONFIRM：确认收货
 *
 * @author yxmds
 */
@Getter
public enum KolOrderFlowPointEnum {

    PAY_SUCC("PAY_SUCC", "支付成功"),
    REFUND("REFUND", "退款"),
    SETTLE("SETTLE", "结算"),
    CONFIRM("CONFIRM", "确认收货"),
    ;

    String index;
    String value;

    KolOrderFlowPointEnum(String index, String value) {
        this.index = index;
        this.value = value;
    }

    public static String indexOf(String idx) {
        return Stream.of(KolOrderFlowPointEnum.values()).filter(e -> Objects.equals(idx, e.index)).map(KolOrderFlowPointEnum::getValue).findFirst().orElse("");
    }

    public static String nameOf(String name) {
        return Stream.of(KolOrderFlowPointEnum.values()).filter(e -> Objects.equals(name, e.value)).map(KolOrderFlowPointEnum::getIndex).findFirst().orElse("");
    }
}
